<!--- Special Procedure
Revive 8 records from Student_2014_PB_20140410 that were deleted but shouldn't have been.  Move them to Student_2014_PB and Evaluation_2014_PB.

Records are for Workshop_ID 5280
Student_IDs are 203815, 16, 18, 19, 20, 21, 22, 25
--->
<cfquery name="GetDeletedHartnell" datasource="WMS">
	select * from Student_2014_PB_20140410
	where student_id = 203815 or student_id = 203816
</cfquery>
<!--- where Deleted = 1
	and Workshop_ID = 5280 --->
<!--- <cfdump var="#GetDeletedHartnell#"> --->

<cfloop query="GetDeletedHartnell">
	<!--- GetEvaluation --->
	<cfquery name="GetHartnellEvaluation" datasource="WMS">
		select *
		from Evaluation_2014_PB_20140410
		where Student_ID = #Student_ID#
	</cfquery>
	<!--- <cfdump var="#GetHartnellEvaluation#"> --->
	<!--- undelete records --->
	<cfquery name="UndeleteHartnell" datasource="WMS">
		update Student_2014_PB_20140410
		set Deleted = 0
		where Student_ID = #Student_ID#
	</cfquery>
	<!--- Move student rec to Student_2014_PB --->
	<cfquery name="InsertStudentPB" datasource="WMS">
		INSERT INTO [WMS].[dbo].[Student_2014_PB]
		(
			[Sequence]
			,[Deleted]
			,[Origin]
			,[Workshop_ID]
			,[First_Name]
			,[Last_Name]
			,[Address]
			,[City]
			,[Zip_Code]
			,[DOB]
			,[Phone1]
			,[Phone2]
			,[Email]
			,[SSN_Code]
			,[SSN]
			,[Date_Created]
			,[Created_By]
			,[Migrated]
			,[Student_ID_Live]
		)
		VALUES
		(
			#Sequence#
			,0
			,'Paper'
			,<cfqueryparam cfsqltype="cf_sql_integer" value="#Workshop_ID#" null="#IIf(Len(Trim(Workshop_ID)) eq 0, DE(true), DE(false))#">
			
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(First_Name)#" null="#IIf(Len(Trim(First_Name)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Last_Name)#" null="#IIf(Trim(Trim(Last_Name)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Address)#" null="#IIf(Trim(Trim(Address)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(City)#" null="#IIf(Len(Trim(City)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Zip_Code)#" null="#IIf(Len(Trim(Zip_Code)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_date" value="#Trim(DOB)#" null="#IIf(Len(Trim(DOB)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(Phone1)#" null="#IIf(Len(trim(Phone1)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#trim(Phone2)#" null="#IIf(Len(trim(Phone2)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(LCase(Email))#" null="#IIf(Len(Trim(Email)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(SSN_Code)#" null="#IIf(Len(Trim(SSN_Code)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(SSN)#" null="#IIf(Len(Trim(SSN)) eq 0, DE(true), DE(false))#">
			
			,#Now()#
			,'#Created_By#'
			,0
			,NULL
		)
		select @@identity as studentID
	</cfquery>
	<!--- Move evaluation rec to Evaluation_2014_PB --->
	<cfquery name="InsertEvaluationPB" datasource="WMS">
		INSERT INTO [WMS].[dbo].[Evaluation_2014_PB]
		(
			Deleted
			,[Student_ID]
			,[q1]
			,[q2]
			,[q3]
			,[q4]
			,[q5]
			,[q6]
			,[q7]
			,[q8]
			,[q9]
			,[q9_other]
			,[q10]
			,[q11]
			,[q12]
			,[q12_other]
			,[q13]
			,[q13_other]
			,[q14]
			,[q14_other]
			,[q15]
			,[q16]
			,[q16_other]
			,[q17]
			,[q18]
			,[q18_other]
			,[q19]
			,[q20]
			,[Date_Created]
			,Migrated
			,Evaluation_ID_Live
		)
		VALUES
		(
			0
			,#InsertStudentPB.studentID#
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q1)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q1)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q2)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q2)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q3)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q3)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q4)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q4)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q5)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q5)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q6)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q6)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q7)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q7)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q8)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q8)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q9)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q9)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q9_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q9_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q10)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q10)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q11)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q11)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q12)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q12)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q12_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q12_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q13)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q13)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q13_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q13_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q14)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q14)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q14_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q14_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q15)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q15)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q16)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q16)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q16_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q16_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q17)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q17)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q18)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q18)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q18_other)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q18_other)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q19)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q19)) eq 0, DE(true), DE(false))#">
			,<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(GetHartnellEvaluation.q20)#" null="#IIf(Len(Trim(GetHartnellEvaluation.q20)) eq 0, DE(true), DE(false))#">
			,#Now()#
			,0
			,Null
		)
		select @@identity as evaluationID
	</cfquery>
		   
</cfloop>

Done.